<?php
class DogTag {
   public $words = "If you find me, please call 555-1212.";
}   
   
class Dog {
    public $name;  
    public $color;
    public $dog_tag;

    public function __construct($dog_name, $dog_color='') {
       $this->name = $dog_name;
       $this->color = $dog_color;
       $this->dog_tag = new DogTag;
       $this->greeting();
       read_dog_tag($this);
    }

    public function greeting() {
        echo $this->name." the ".$this->color." dog says ";
        $this->bark();
        echo "<br>";
    }

    public function bark() {
        print "Woof!";
    }
}

class Poodle extends Dog {
   public $possible_colors = array('white','black','silver','blue',
                                   'cream','apricot','red','brown');
   
   public function bark() {
      print "Yip!";
   }
}

function read_dog_tag(Dog $some_dog) {
   echo $some_dog->dog_tag->words;
   echo "<br>";
}

function is_dog($parameter) {
  if ($parameter instanceof Dog) {
    echo $parameter->name." is a Dog or Dog breed.<br>";
    return true;
  }
  else if (is_object($parameter)) {
    echo "This object is not a Dog, it's a ".get_class($parameter).".<br>";
    return false;
  }
  else {
    echo "This is not even an object, it's a ".gettype($parameter).".<br>";
    return false;
  }
}

$thisdog = new Dog('Wilson');
$anotherdog = new Dog('Harley','black');
$thispoodle = new Poodle('Penny','white');
?>